using System;
using System.Collections.Generic;
using System.Text;
using Decav.Reality;
using Decav.Gatsb.Mobile;

namespace Decav.Gatsb.MobileProviders
{
    /// <summary>
    /// The TMobile telephone service provider.
    /// </summary>
    [Serializable]
    public class TmobileServiceProvider : TelephoneServiceProvider
    {
        public TmobileServiceProvider()
            : base("T-Mobile")
        {
        }

        public override EmailAddress CreateSmsAddress(PhoneNumber phoneNumber)
        {
            return new EmailAddress(string.Format("1{0}@tmomail.net", phoneNumber));
        }

        public override EmailAddress CreateMmsAddress(PhoneNumber phoneNumber)
        {
            return new EmailAddress(string.Format("1{0}@tmomail.net", phoneNumber));
        }

        public override bool IsProviderMailAddress(string mailAddress)
        {
            mailAddress = mailAddress.ToLower();

            return (mailAddress.EndsWith("@tmomail.net") || mailAddress.EndsWith("@tmail.com"));
        }

        public override IPhoneMessageParser CreateMessageParser()
        {
            return new TmobileMessageParser();
        }
    }
}
